<div class="title">{ %lang s1 }</div>
<script language="javascript">
var dbototal = { %count #dbo}; 
function addnewdb(){
current = dbototal+1;
string = '<div id="dboform'+current+'">';
string +='<select name="db['+current+'][driver]">{ %loop #drivers }<option value="{#drivers[i]}">{#drivers[i]}</option>{/loop}</select>';
string +='<input type="text" size="10" name="db['+current+'][server]">';
string +='<input type="text" size="10" name="db['+current+'][db]">';
string +='<input type="text" size="10" name="db['+current+'][port]">';
string +='<input type="text" size="10" name="db['+current+'][user]">';
string +='<input type="password" size="10" name="db['+current+'][password]">';
string +='<a href="javascript:removedb('+current+');">{ %lang s14}</a></div>';
$("#dbocontainer").append(string);
dbototal++;
}
function removedb(id){
if( dbototal==1){
	alert("{ %lang s17}"+dbototal);
	return;
}
$("#dboform"+id).remove();
dbototal--;
}
</script>
<form action="" method="post">
<table cellspacing="4" cellpadding="4">
<tr> <td> { %lang s3} </td> <td> <input type="text" name="name" value="{ #sys[name]}" > </td> </tr>
<tr> <td> { %lang s4} </td> <td><select name="language">{ %loop #langs }<option value="{#langs[i]}" { %if {#sys[language]} eq {#langs[i]}}selected{/if}>{#langs[i]}</option>{/loop}</select></td> </tr>
<tr> <td> { %lang s5} </td> <td> <input type="text" name="viewmodel" value="{ #sys[viewmodel]}" > </td> </tr>
<tr> <td> { %lang s6} <a href="##" onClick="javascript:alert('{ %lang sd6}');">?</a></td> <td> <input type="text" name="routermap" value="{ #sys[routermap]}" > </td> </tr>
<tr> <td> { %lang s7} <a href="##" onClick="javascript:alert('{ %lang sd7}');">?</a></td> <td> <select name="multiaccess"><option value="1" { %if {#sys[multiaccess]} eq true }selected{/if}>{ %lang f13}</option><option value="0" { %if {#sys[multiaccess]} eq false }selected{/if}>{ %lang f14}</option></select> </td> </tr>
<tr> <td> { %lang s8} <a href="##" onClick="javascript:alert('{ %lang sd8}');">?</a></td> <td> <select name="logtofile"><option value="1" { %if {#sys[logtofile]} eq true }selected{/if}>{ %lang f13}</option><option value="0" { %if {#sys[logtofile]} eq false }selected{/if}>{ %lang f14}</option></select> </td> </tr>
<tr> <td colspan="2"><b>{ %lang s12}</b></td></tr>
<?php for($i=0;$i<count($dbo);$i++) { ?>
<tr> <td colspan="2">
<div id="dboform<?php print $i;?>"><select name="db[<?php print $i;?>][driver]"> { %loop j=#drivers } <option value="{#drivers[j]}" { %if {#dbo[<?php print $i;?>][driver]} eq {#drivers[j]} }selected{/if} >{#drivers[j]}</option>{/loop}</select>
<input type="hidden" name="db[<?php print $i;?>][driver]" value="{#dbo[<?php print $i;?>][driver]}">
<input type="text" name="db[<?php print $i;?>][server]" value="{#dbo[<?php print $i;?>][server]}" size="10">
<input type="text" name="db[<?php print $i;?>][db]" value="{#dbo[<?php print $i;?>][db]}" size="10" >
<input type="text" name="db[<?php print $i;?>][port]" value="{#dbo[<?php print $i;?>][port]}" size="10" >
<input type="text" name="db[<?php print $i;?>][user]" value="{#dbo[<?php print $i;?>][user]}" size="10" >
<input type="password" name="db[<?php print $i;?>][password]" value="{#dbo[<?php print $i;?>][password]}" size="10" >
{ %if {%count #dbo} > 1 }<a href="javascript:removedb(<?php print $i;?>);">{ %lang s14}</a>{/if}
</div>
</td></tr>
<?php } ?>
<tr>
<td colspan="2"> <div id="dbocontainer"></div> </td>
</tr>
<tr>
<td colspan="2"><a href="javascript:addnewdb();">{ %lang s13 }</a></td>
</tr>
{ %if { %count #dbo} > 1 }
<tr> <td>{ %lang s15} <a href="##" onClick="javascript:alert('{ %lang sd15}');">?</a> </td> <td><input type="checkbox" name="dbodatareplication" { %if {#sys[dbodatareplication]} eq true}checked{/if} ></td> </tr>
{/if}
<tr> <td>{ %lang s16}</td> <td><input type="checkbox" name="dbopersistent" { %if {#sys[dbopersistent]} eq true}checked{/if}></td> </tr>
<tr> <td colspan="2" > <input type="Submit" class="button" name="Submit" value="{%lang s2}" > </td> </tr>
</table>
</form>